home *** CD-ROM | disk | FTP | other *** search
/ Champak Vol A-4 / (Vol A-4) Vol. A4.iso / Games / the-kitchen-of-doom.swf / scripts / DefineSprite_1104 / frame_21 / DoAction.as
Text File  |  2008-03-14  |  4KB  |  147 lines

  1. function showScores(pg)
  2. {
  3.    var _loc2_ = pg;
  4.    var _loc1_ = 0;
  5.    while(_loc1_ < 10)
  6.    {
  7.       hiscoreTableInst["n" + _loc1_] = scores["n" + (_loc1_ + _loc2_ * step)];
  8.       hiscoreTableInst["s" + _loc1_] = p + scores["s" + (_loc1_ + _loc2_ * step)] + s;
  9.       if(hiscoreTableInst["n" + _loc1_] == undefined)
  10.       {
  11.          hiscoreTableInst["n" + _loc1_] = "   -   ";
  12.       }
  13.       if(scores["s" + (_loc1_ + _loc2_ * step)] == undefined)
  14.       {
  15.          hiscoreTableInst["s" + _loc1_] = p + "0000000" + s;
  16.       }
  17.       if(_loc2_ * step + _loc1_ + 1 > 9)
  18.       {
  19.          hiscoreTableInst["num" + _loc1_] = _loc2_ * step + _loc1_ + 1;
  20.       }
  21.       else
  22.       {
  23.          hiscoreTableInst["num" + _loc1_] = "0" + (_loc2_ * step + _loc1_ + 1);
  24.       }
  25.       _loc1_ = _loc1_ + 1;
  26.    }
  27. }
  28. stop();
  29. if(_parent.sendToFriendMode == 0)
  30. {
  31.    challengeButtonInst._visible = false;
  32.    sendButtonInst._visible = true;
  33. }
  34. else
  35. {
  36.    challengeButtonInst._visible = true;
  37.    sendButtonInst._visible = false;
  38. }
  39. sendButtonInst.onRelease = function()
  40. {
  41.    var _loc1_ = _parent;
  42.    _global.sfxUI.start();
  43.    _loc1_.sendBoxInst._visible = true;
  44.    Selection.setFocus(_loc1_.sendBoxInst.name);
  45.    _loc1_.sendBoxInst.name.text = "";
  46.    _loc1_.sendBoxInst.email.text = "";
  47.    menuButtonInst.enabled = false;
  48.    sendButtonInst.enabled = false;
  49.    downArrowInst.enabled = false;
  50.    upArrowInst.enabled = false;
  51. };
  52. challengeButtonInst.onRelease = function()
  53. {
  54.    var _loc1_ = _parent;
  55.    _global.sfxUI.start();
  56.    _loc1_.challengeBoxInst._visible = true;
  57.    Selection.setFocus(_loc1_.challengeBoxInst.name);
  58.    _loc1_.challengeBoxInst.name.text = "";
  59.    _loc1_.challengeBoxInst.email.text = "";
  60.    menuButtonInst.enabled = false;
  61.    sendButtonInst.enabled = false;
  62.    downArrowInst.enabled = false;
  63.    upArrowInst.enabled = false;
  64. };
  65. page = 0;
  66. maxPage = 4;
  67. step = 10;
  68. upArrowInst._visible = false;
  69. upArrowInst.enabled = false;
  70. downArrowInst.enabled = false;
  71. upArrowInst.onRelease = function()
  72. {
  73.    _global.sfxUI.start();
  74.    page--;
  75.    showScores(page);
  76.    downArrowInst._visible = true;
  77.    if(page == 0)
  78.    {
  79.       upArrowInst._visible = false;
  80.    }
  81. };
  82. downArrowInst.onRelease = function()
  83. {
  84.    _global.sfxUI.start();
  85.    page++;
  86.    showScores(page);
  87.    upArrowInst._visible = true;
  88.    if(page == maxPage)
  89.    {
  90.       downArrowInst._visible = false;
  91.    }
  92. };
  93. var i = 0;
  94. while(i < 10)
  95. {
  96.    hiscoreTableInst["n" + i] = "   -   ";
  97.    hiscoreTableInst["s" + i] = p + "0000000" + s;
  98.    i++;
  99. }
  100. scores = new LoadVars();
  101. scores.game = hiscoreTable;
  102. scores.gameID = hiscoreTableID;
  103. if(_parent.scoreMode == 0)
  104. {
  105.    scores.cmd = "1";
  106. }
  107. else
  108. {
  109.    scores.cmd = "0";
  110.    scores.name = nameEntry;
  111.    scores.score = scoreEntry;
  112. }
  113. scores.onLoad = function(success)
  114. {
  115.    if(success)
  116.    {
  117.       if(this.res == "0")
  118.       {
  119.          gotoAndStop("HiscoreFail");
  120.          play();
  121.       }
  122.       else
  123.       {
  124.          for(var _loc1_ in scores)
  125.          {
  126.             i++;
  127.             if(i % 2 == 1)
  128.             {
  129.                hiscoreTableInst[_loc1_] = p + scores[_loc1_] + s;
  130.             }
  131.             else
  132.             {
  133.                hiscoreTableInst[_loc1_] = scores[_loc1_];
  134.             }
  135.          }
  136.          upArrowInst.enabled = true;
  137.          downArrowInst.enabled = true;
  138.       }
  139.    }
  140.    else
  141.    {
  142.       gotoAndStop("HiscoreFail");
  143.       play();
  144.    }
  145. };
  146. scores.sendAndLoad("http://hiscores.fishinabottle.com/submitscore.php",scores,"POST");
  147.